<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			// var arr = [1, 1, 1, 2, 2, 3, 3, 3, 3, 3]
			var arr = [5, 5, 5, 5, 2, 1, 1, 1, 1, 1]
			// 方法1
			for (var i = 0; i < arr.length; i++) {
				if (arr[i] > arr[i+1]){
					console.log('降序')
					break;
				} else if (arr[i] < arr[i+1]) {
					console.log('升序')
					break;
				}
			}
			
			// 方法2
			bool = arr.every((item, i) => {
				return i < arr.length - 1 ? item <= arr[i + 1] : true
			})
			console.log(bool ? '升序' : '降序')
		</script>
	</body>
</html>
